import request from '@/config/axios'

export interface CatalogVO {
  id: string
  code: string
  name: string
  parentId: string
  sort: number
  valid: number
  hierarchy: string
  dataTable: string
}

// 查询资产分类分页
export const getCatalogPage = async (params) => {
  return await request.get({ url: `/eam/catalog/page`, params })
}

// 查询资产分类详情
export const getCatalog = async (id: number) => {
  return await request.get({ url: `/eam/catalog/get?id=` + id })
}

// 新增资产分类
export const createCatalog = async (data: CatalogVO) => {
  return await request.post({ url: `/eam/catalog/create`, data })
}

// 修改资产分类
export const updateCatalog = async (data: CatalogVO) => {
  return await request.put({ url: `/eam/catalog/update`, data })
}

// 删除资产分类
export const deleteCatalog = async (id: number) => {
  return await request.delete({ url: `/eam/catalog/delete?id=` + id })
}

// 导出资产分类 Excel
export const exportCatalog = async (params) => {
  return await request.download({ url: `/eam/catalog/export-excel`, params })
}